/* File : mCommandProcessor.cpp
*  Dibuat Oleh : 23512077/ Ni Made Satvika Iswari
*/

#include "CommandProcessor.h"
#include "../File/FileExp.h"

int main(){
	CommandProcessor tCP;
	cout << "Apakah tCP kosong? "<< tCP.IsEmpty() << endl;
	
	command C1,C2,C3;
	
	/* Inisialisasi comman */
	C1.setArgument("Display_Command#<fileName>");
	C1.setDurSecond(1);
	
	C2.setArgument("Add#<a_calendar,entryNo>");
	C2.setDurSecond(2);
	
	C3.setArgument("Delete# <a_calendar, entryNo>");
	C3.setDurSecond(3);
	
	vector<command> vCommand;
	vCommand.push_back(C1);
	vCommand.push_back(C2);
	
	/* Tes konstruktor berparameter */
	CommandProcessor CP(vCommand);
	
	cout << "Apakah CP kosong? "<< CP.IsEmpty() << endl;
	
	cout << "Status add command C3 : " << CP.AddCommand(C3) << endl;
	cout << "Isi CP : "<< endl;
	CP.DisplayUserCommand();
	
	if(!CP.IsEmpty()){
		CP.DelCommand(C3);
	}
	
	cout << "Isi CP : "<< endl;
	CP.DisplayUserCommand();
	
	try{
		CP.ReadFile("Command10.txt");	//File default daftar command valid
	}catch(FileExp& f){
		f.DisplayMsg();
	}
	
	cout << "Display Ref Command" << endl;
	CP.DisplayRefCommand();
	
	CP.SaveFile("Command1.txt");
	
	return 0;
}